<template>
  <div class="stars">
    <div class="star"></div>
    <div class="star"></div>
    <div class="star"></div>
    <!-- <div class="star"></div> -->
    <!-- <div class="star"></div> -->
  </div>
</template>

<script>
export default {

}
</script>

<style lang="scss" scoped>
.stars {
  position: fixed;
  pointer-events: none;
  top: -20%;
  left: 0%;
  z-index: 2;
  width: 120%;
  height: 120%;
  transform: rotate(-45deg);
  .star {
    --star-color: var(--primary-color);
    --star-tail-length: 6em;
    --star-tail-height: 2px;
    --star-width: calc(var(--star-tail-length) / 6);
    --fall-duration: 20s;
    --tail-fade-duration: var(--fall-duration);
    position: absolute;
    top: var(--top-offset);
    left: 0;
    width: var(--star-tail-length);
    height: var(--star-tail-height);
    color: var(--star-color);
    background: linear-gradient(45deg, #fff, transparent);
    border-radius: 50%;
    filter: drop-shadow(0 0 6px #fff);
    transform: translate3d(104em, 0, 0);
    animation: fall var(--fall-duration) var(--fall-delay) linear infinite, tail-fade var(--tail-fade-duration) var(--fall-delay) ease-out infinite;
  }
  .star:nth-child(1) {
    --star-tail-length: 6.07em;
    --top-offset: 16.71vh;
    --fall-duration: 7s;
    --fall-delay: 1.5s;
  }
  .star:nth-child(2) {
    --star-tail-length: 6.07em;
    --top-offset: 19.71vh;
    --fall-duration: 5s;
    --fall-delay: 4.5s;
  }
  .star:nth-child(3) {
    --star-tail-length: 5.87em;
    --top-offset: 66.77vh;
    --fall-duration: 3s;
    --fall-delay: 9s;
  }
  .star:nth-child(4) {
    --star-tail-length: 5.87em;
    --top-offset: 66.77vh;
    --fall-duration: 22s;
    --fall-delay: 7.5s;
  }
  .star::before, .star::after {
    position: absolute;
    content: '';
    top: 0;
    left: calc(var(--star-width) / -2);
    width: var(--star-width);
    height: 100%;
    background: linear-gradient(45deg, transparent, #fff, transparent);
    border-radius: inherit;
    animation: blink 2s linear infinite;
  }
  .star::before {
    transform: rotate(45deg);
  }
  .star::after {
    transform: rotate(-45deg);
  }

  @keyframes fall {
    to {
      transform: translate3d(-30em, 0, 0);
    }
  }
  @keyframes tail-fade {
    0%, 50% {
      width: var(--star-tail-length);
      opacity: 1;
    }
    70%, 80% {
      width: 0;
      opacity: 0.6;
    }
    100% {
      width: 0;
      opacity: 0;
    }
  }
  @keyframes blink {
    50% {
      opacity: 0.6;
    }
  }
}
</style>